package ycl.common.base.controller;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import ycl.common.ApiResult;
import ycl.common.base.entity.BaseRegionEntity;
import ycl.common.models.req.BaseRegionReq;
import ycl.common.models.res.BaseRegionEntityRes;

import javax.validation.constraints.NotBlank;
import java.util.List;

/**
 * 区域控制器基类
 *
 * @author: YCL
 * @date: 2021-10-30 09:15:57
 */
@RestController
public abstract class BaseRegionController
		<T extends BaseRegionEntity,
				Q extends BaseRegionReq,
				R extends BaseRegionEntityRes>
		extends BaseController<T, Q, R> {


	@GetMapping("/getByCode")
	@ApiOperation("根据区域代码获取地区")
	@ApiOperationSupport(order = 11)
	public abstract ApiResult<T> getByCode(String code);


	@GetMapping("/getByParentCode")
	@ApiOperation("根据上级区域代码获取地区")
	@ApiOperationSupport(order = 12)
	public abstract ApiResult<List<T>> getByParentCode(@NotBlank(message = "请传入区域代码") String code);

}
